#include "Cook.h"
#include "mongoose.h"

Cook::Cook()
{
    started = false;
    elapsed = 0;
}

void Cook::clear()
{
    while (!t_t.empty())
    {
        t_t.pop();
    }
}

void Cook::add_data(mData data)
{
    t_t.push(data);
}

void Cook::start()
{
    if (!started)
    {
        started = true;
        LOG(LL_INFO, ("started\n"));
        // get time
        now = mg_time();
        // start timer
        id_elapsed = mgos_set_timer(1000, true, cb_time_elapsed, this);
    }
}

void Cook::stop()
{
    started = false;
    LOG(LL_INFO, ("stoped\n"));
    mgos_clear_timer(id_elapsed);
}